#!/bin/bash

if [[ ( -z $1 ) || ( ! -f $1 ) ]] ; then
   echo "usage: deploydev.sh filename";
   exit -1;
fi

dname="/usr/home/atlantaa/sites/dev.aaatlanta.org/"`basename $1 .tgz`
echo "deploying to $dname"

if [[ -d $dname ]] ; then
   rm -rf $dname
fi

mkdir $dname
tar xzf $1 -C $dname

lname="/usr/home/atlantaa/public_html/dev.aaatlanta.org/CentralOffice"
if [[ -h $lname ]] ; then 
   rm -f $lname
fi
ln -s $dname $lname

cat index.htaccess > $dname/.htaccess
cat dev.admin.htaccess > $dname/admin/.htaccess

rm -rf $dname/xlsdata
ln -s "/usr/home/atlantaa/xlsdata/dev.aaatlanta.org" $dname/xlsdata

